#!/usr/bin/env python
# -*- coding:utf-8 -*-

from django.template import Library
from django.urls import reverse
from django.http import QueryDict
from django.conf import settings
from teach.utils.urls import advanced_url as ad_url

register = Library()


@register.simple_tag
def is_active(cid, id):
    if str(cid) == str(id):
        return 'active'


@register.simple_tag
def advanced_url(request, name, **kwargs):
    """
    反向生成含条件的URL
    :param request: 请求相关所有数据
    :param name: 反向生成URL的别名
    :param kwargs: 参数
    :return:
    """
    return ad_url(request, name, **kwargs)
